<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理员界面</title>
    <!-- 引入element-ui样式 -->
    <link rel="stylesheet" href="../../plugins/element-ui/index.css">


    <style>
        .el-header {
            background-color: #B3C0D1;
            color: #333;
            line-height: 60px;
        }

        .el-aside {
            color: #333;
        }
    </style>

</head>
<body>
<div id="app">


    <el-container style="height: 700px; border: 1px solid #eee">

        <!--1.侧边菜单-->
        <el-aside width="200px" style="background-color: #545c64">
            <el-menu
                    default-active="2"
                    class="el-menu-vertical-demo"
                    @open="handleOpen"
                    @close="handleClose"
                    background-color="#545c64"
                    text-color="#fff"
                    active-text-color="#ffd04b">

                <el-submenu index="1">
                    <template slot="title"><i class="el-icon-s-custom"></i>用户管理</template>
                    <el-menu-item-group>
                        <template slot="title">个人信息</template>
                        <el-menu-item index="1-1" @click="clickUrl(0)">修改个人信息</el-menu-item>
                    </el-menu-item-group>

                    <el-menu-item-group>
                        <template slot="title">账号管理</template>
<!--                        <el-menu-item index="1-2" @click="clickUrl(1)">管理员信息</el-menu-item>-->
                        <el-menu-item index="1-3" @click="clickUrl(2)">客户信息</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>

                <el-submenu index="2">
                    <template slot="title"><i class="el-icon-s-data"></i>游泳池管理</template>
                    <el-menu-item-group>
                        <template slot="title">信息</template>
                        <el-menu-item index="2-1" @click="clickUrl(3)">分类信息</el-menu-item>
                        <el-menu-item index="2-2" @click="clickUrl(4)">游泳池信息</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>

                <el-submenu index="3">
                    <template slot="title"><i class="el-icon-s-order"></i>收费信息</template>
                    <el-menu-item-group>
                        <template slot="title">分组一</template>
                        <el-menu-item index="3-1" @click="clickUrl(6)">用户订单</el-menu-item>
                        <el-menu-item index="3-2" @click="clickUrl(7)">收费功能(数据可视化)</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>

                <el-submenu index="4">
                    <template slot="title"><i class="el-icon-picture"></i>轮播图</template>
                    <el-menu-item-group>
                        <template slot="title">分组一</template>
                        <el-menu-item index="4-1" @click="clickUrl(8)">轮播图管理</el-menu-item>
                    </el-menu-item-group>
                </el-submenu>




            </el-menu>
        </el-aside>



        <!--2.上边栏-->
        <el-container style=" text-align: right; font-size: 12px;">
            <el-header style="text-align: right; font-size: 12px;background-color: #545c64">

                <img style="width: 50px;height: 50px;border-radius: 40%;position: absolute;margin: 5px 0 0 -60px" :src="imageUrl">
                <el-dropdown>
                    <i class="el-icon-setting" style="margin-right: 15px"></i>
                    <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item>
                            <p @click="clickUrl(0)">修改个人信息</p>
                        </el-dropdown-item>
                        <el-dropdown-item>
                            <p @click="loginOut(1)">退出账号</p>
                        </el-dropdown-item>
                    </el-dropdown-menu>
                </el-dropdown>

            <span> {{ adminInfo.data.name }}</span>
            </el-header>

            <!--3.主内容(iframe)-->
                <el-main>
                    <iframe
                            :src="iframeUrl"
                            frameborder="0"
                            name="iframe0"
                            width="100%"
                            height="100%"
                    ></iframe>
                </el-main>
        </el-container>
    </el-container>


</div>


<script src="../../plugins/vue/vue.js"></script>

<!-- 引入element-ui组件库 -->
<script src="../../plugins/element-ui/index.js"></script>

<!-- 引入axios -->
<script src="../../plugins/axios/axios.min.js"></script>

<script>
    new Vue({
        el:'#app',    //element
        data:{
            infoName:'',  //标题
            adminInfo:{}, //当前用户信息
            iframeUrl:'adminWelcome.html', //主内容的url

            imageUrl:''
        },
        created() {
            const adminInfo = window.localStorage.getItem('admin')
            console.log("adminInfo1:::"+adminInfo)
            if (adminInfo) {
                this.adminInfo = JSON.parse(adminInfo)
            }
            console.log("adminInfo2:::"+adminInfo)

            this. imageUrl=`/files/downloadFile?name=${this.adminInfo.data.image}`
        },
        methods:{

            clickUrl(index){
                if (index=="0"){
                    this.infoName='个人信息修改'
                    this.iframeUrl='list/updateMyself.html'
                } else if (index=="1"){
                    this.infoName='管理员账号'
                    this.iframeUrl='list/adminList.html'
                }else if (index=="2"){
                    this.infoName='客户信息'
                    this.iframeUrl='list/userList.html'
                } else  if (index=="3"){
                    this.infoName='分类信息'
                    this.iframeUrl='list/typeList.html'
                }else  if (index=="4"){
                    this.infoName='游泳池信息'
                    this.iframeUrl='list/natatoriumList.html'
                }else if (index=="6"){
                    this.infoName='用户订单'
                   this.iframeUrl='list/ordersList.html'
                }else if (index=="7"){
                    this.infoName='收费功能'
                   this.iframeUrl='list/natatoriumNum.html'
                }else if (index=="8"){
                    this.infoName='轮播图管理'
                   this.iframeUrl='list/carouselList.html'
                }
            },
            loginOut(){
                localStorage.setItem('admin',null)
                window.location.href='../login/AdminLogin.html';
            },
        }

    })
</script>

</body>
</html>
